]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
MessageTray: keep notification focused through update()
authorDan Winship <danw@gnome.org>
Wed, 2 Mar 2011 14:48:29 +0000 (09:48 -0500)
committerMarina Zhurakhinskaya <marinaz@redhat.com>
Tue, 22 Mar 2011 22:20:33 +0000 (18:20 -0400)
If a notification was updated while one of its widgets was focused,
it would lose the grab when that widget was destroyed. Fix that by
moving the focus to a safe place before destroying the old widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=643687

js/ui/messageTray.js

index a2810390cde7100c84b775ac7e6435f27c2aa02e..f951801673601cdef829f7076e0ac632a5487e2b 100644 (file)
@@ -467,17 +467,25 @@ Notification.prototype = {
 
         this._customContent = params.customContent;
 
+        let oldFocus = global.stage.key_focus;
+
         if (this._icon)
             this._icon.destroy();
         // We always clear the content area if we don't have custom
         // content because it might contain the @banner that didn't
         // fit in the banner mode.
         if (this._scrollArea && (!this._customContent || params.clear)) {
+            if (oldFocus && this._scrollArea.contains(oldFocus))
+                this.actor.grab_key_focus();
+
             this._scrollArea.destroy();
             this._scrollArea = null;
             this._contentArea = null;
         }
         if (this._actionArea && params.clear) {
+            if (oldFocus && this._actionArea.contains(oldFocus))
+                this.actor.grab_key_focus();
+
             this._actionArea.destroy();
             this._actionArea = null;
             this._buttonBox = null;